/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Lab_v3;
import java.util.Hashtable;
/**
 *
 * @author salman
 */
public class dbtables_mcq_options extends dbtables_handler {

    private static String table_name= "mcq_options";

    public dbtables_mcq_options(String database_type,String database_name)
    {
       super(database_type,database_name);
//        if (table_name != null)
//        {
//           table_name =  new_table_name;
//        }
        p_table_name = table_name;

    }

    public void insertSingleEntry(String key,String alpha_option, String option_value,String is_right_bool, String question_id)
    {
        String insertParameters = "'"+key+"','"+alpha_option+"','"+option_value+"','"+is_right_bool+"','"+question_id+"'";
       // insertParameters = "'18','jsdfsdfhds','sdsdfdsfsdfsd'";
       // String s = "'11','shit','de  sdfsdf s fdsshit'";
        insertData(insertParameters);

    }


    public void viewAllEntries()
    {
      String[] fieldNames = {"mcq_id","mcq_aplha_option","option_value","is_right","question_id"};
        fetchAndViewAllData (fieldNames);

    }

            public Hashtable getSingleMCQOPtions(String searchfeildColumn,String searchfieldValue)
    {
      String[] fieldNames = {"mcq_id","mcq_aplha_option","option_value","is_right","question_id"};
       Hashtable a = new Hashtable();
   a = fetchSingleRow (searchfeildColumn,searchfieldValue,fieldNames);
       return a;
    }

        public Hashtable getAllMCQOptions()
    {
    String[] fieldNames = {"mcq_id","mcq_aplha_option","option_value","is_right","question_id"};
       Hashtable a = new Hashtable();
   a = fetchAllRows (null,null,fieldNames);
       return a;
    }

        public Hashtable getAllRightAnswers(String test_id)
    {
       //  String[] fieldNames = {"mcq_id","option_value","is_right","question_id"};
       Hashtable a = new Hashtable();
   a = getRightOptions(test_id);
       return a;
        }
}
